package web;

import java.util.List;

import vo.PK;
import business.PKService;

import com.opensymphony.xwork2.Action;
import com.opensymphony.xwork2.Preparable;

@SuppressWarnings("unchecked")
public class PKAction implements Preparable {
	private PKService service;
	private List<PK> PKs;

	// PK用的变量
	private String left;
	private String right;
	private int score;

	public String listPK() {
		this.PKs = service.getAllPKs();
		return Action.SUCCESS;
	}

	public String addPK() {
		service.addPK("hello xxx");
		return listPK();
	}

	public String showPK() {
		System.out.println("show PK");
		return Action.SUCCESS;
	}

	public String pk() {
		System.out.println("PK");
		System.out.println("left:" + left);
		System.out.println("right:" + right);
		PK pk = new PK();
		pk.setLeftImage(left);
		pk.setRightImage(right);
		pk.setScore(score);
		service.addPK(pk);
		return Action.SUCCESS;
	}

	public void prepare() throws Exception {
		// if (id != null)
		// employee = service.find(id);
	}

	public void setPKService(PKService service) {
		this.service = service;
	}

	public List<PK> getPKs() {
		return PKs;
	}

	public void setPKs(List<PK> pKs) {
		PKs = pKs;
	}

	public void setService(PKService service) {
		this.service = service;
	}


	public String getLeft() {
		return left;
	}

	public void setLeft(String left) {
		this.left = left;
	}

	public String getRight() {
		return right;
	}

	public void setRight(String right) {
		this.right = right;
	}

	public int getScore() {
		return score;
	}

	public void setScore(int score) {
		this.score = score;
	}

}